package com.ly.ql.Wms.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.locks.ReentrantLock;

public class IdGenerate {
    private static ReentrantLock lock = new ReentrantLock(); //使用ReenTrantLock加锁生成唯一单号
    public static long newOID(){
        long now = 0;
        lock.lock();
        try {
            //------------------流水号业务逻辑----------------
            now = System.currentTimeMillis();
            //5位流水号
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            //释放锁
            lock.unlock();
        }
        return now;
    }
}
